package com.hdkn.springBootDemoApp;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;

import javax.servlet.http.HttpServletRequest;

import net.sf.json.JSONObject;
import net.sf.json.util.JSONUtils;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.fasterxml.jackson.databind.util.JSONPObject;

@SpringBootApplication
@RestController
@RequestMapping("/demo")
public class Demo1 {

	public static void main(String[] args) {
		SpringApplication.run(Demo1.class, args);
	}
	
	@RequestMapping(value = {"/webhook/test",""})
    public String helloboot(){

        return "hello boot !!" ;
    }
	
	@RequestMapping(value = {"/webhook/send",""},method = RequestMethod.POST)
    public @ResponseBody String send(@RequestBody JSONObject pushMsg, HttpServletRequest request) throws UnsupportedEncodingException{
		

		System.out.println(pushMsg);

		//测试一下webhook1111111

        return "{\"errcode\":0,\"errmsg\":\"ok\"}";
    }
	
	
}
